<div class="row-fluid">
    <div class="span12">
        <div class="box box-bordered box-color">
            <div class="box-content">
                <?php
                echo $this->Form->create('Season',array('name'=>'frm_season'));
                echo $this->Form->input('id');
                ?>
                <div class="span12 nomargin">
                    <div class="control-group">
                        <div class="controls-row">
                            <div class="controls span12">
                                <label for="nameAnime"><strong>Nome do Anime:</strong>&nbsp;</label>
                                <strong id="nameAnime" class="label label-green"><?php echo $this->data['Anime']['name']; ?></strong>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="controls-row">
                            <div class="controls span3">
                                <?php
                                echo $this->Form->label('dow_episodes','Assistido:');
                                echo $this->Form->input('dow_episodes',array('label'=>false,'div'=>false,'class'=>'input-medium span12','min'=>0,'type'=>'number','id'=>'dow_episode'));
                                ?>
                            </div>
                            <div class="controls span3">
                                <?php
                                echo $this->Form->label('full_episodes','Total:');
                                echo $this->Form->input('full_episodes',array('label'=>false,'div'=>false,'class'=>'input-medium span12','min'=>0,'type'=>'number','id'=>'full_episodes'))?>
                            </div>
                            <div class="controls span3">
                                <?php
                                echo $this->Form->label('start_season','Inicio Temporada:');
                                echo $this->Form->input('start_season',array('label'=>false,'div'=>false,'class'=>'input-medium span12','min'=>0,'type'=>'number','id'=>'start_season'));
                                ?>
                            </div>
                            <div class="controls span3">
                                <?php
                                echo $this->Form->label('end_season','Fim Temporada:');
                                echo $this->Form->input('end_season',array('label'=>false,'div'=>false,'class'=>'input-medium span12','min'=>0,'type'=>'number','id'=>'end_season'))?>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="controls-row">
                            <div class="controls span6">
                                <?php
                                echo $this->Form->label('situation_id','Situação:');
                                echo $this->Form->input('situation_id',array('label'=>false,'div'=>false,'class'=>'input-medium span12','id'=>'situation_season'))?>
                            </div>
                            <div class="controls span6">
                                <?php
                                echo $this->Form->label('rating_id','Avaliação:');
                                echo $this->Form->input('rating_id',array('label'=>false,'div'=>false,'class'=>'input-medium span12','id'=>'end_season'))?>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="controls-row">
                            <div class="controls span6">
                                <?php
                                echo $this->Form->label('status','Status:&nbsp;',array('class'=>'pull-left'));
                                echo $this->Form->input('status',array('label'=>false,'div'=>false,'class'=>'','id'=>'status'));
                                ?>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <?php echo $this->Form->button('<i class=" icon-ok"></i> Concluir',array('type'=>'button','id'=>'btnUpdateAnime','class'=>'btn btn-primary','div'=>'false','escape'=>false)); ?>
                        <?php echo $this->Html->link('<i class="icon-reply"></i> Cancelar','javascrip:void(0);',array('escape'=>false,'class'=>'btn btn-danger ','data-dismiss'=>'modal'))?>
                    </div>
                </div>
                <?php $this->Form->end()?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $("#btnUpdateAnime").click(function(){
            var $rsForm = $('#SeasonUpdateEpisodesForm').serialize();
            var $path = $('base').attr('href');
            var SeasonId = $("#SeasonId").val();
            var $url = $path+'indexs/updateEpisodes/'+SeasonId;
            $.ajax({
                type:"post",
                url:$url,
                data:$rsForm,
                beforeSend:function(){
//                    $("#lista-anime").html('<img alt="" src="/yonkou/img/loading_mini.gif">');
                },
                success:function(html){
                    if(html != false)
                    {
                        $("#UpdateBox").modal('hide');
                        $("#lista-anime").html('');
                        $("#lista-anime").html(html);
                    }
                    else
                    {
                        $("#UpdateBox").modal('hide');
                        alert('Houve um error ao carregar os dados da temporada!')
                    }
                },
                error:function(){}
            })
        });
    });
</script>